Page({
  data: {
    scanCodeMsg: "",

    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '订单查询', //导航栏 中间的标题
    },
    newOrder:'最新订单',
    latestOrder:[
      {
        orderId:'01',
        orderTitle:'运单号',
        orderOdd:'123456789',
        orderTime:'2019-07-30 18:00',
        orderAdd:'北京',
        orderName:'王先生',
        orderState:'运送中',
        orderAdds:'上海',
        orderNames:'刘小姐'
      },
      {
        orderId: '02',
        orderTitle: '运单号',
        orderOdd: '123456789',
        orderTime: '2019-07-30 18:00',
        orderAdd: '广州',
        orderName: '黄先生',
        orderState: '运送中',
        orderAdds: '济南',
        orderNames: '刘小姐'
      }
    ],
  },
  //头部自定义高度
  onLoad: function () {
    var that = this;
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
  },


  //扫码
  scanCode: function () {
    var that = this;
    wx.scanCode({ //扫描API
      success(res) { //扫描成功
        console.log(res) //输出回调信息
        that.setData({
          scanCodeMsg: res.result
        });
        wx.showToast({
          title: '扫码成功',
          icon: 'success',
          duration: 1000
        })
      },
      fail: (res) => {//接口调用失败的回调函数
        wx.showToast({
          title: '扫码失败',
          icon: 'success',
          duration: 1000
        })
      },
    })
  },

  //订单列表
  showTradeDetail: function (e) {
    var $id = e.currentTarget.dataset.id;
    console.log($id)
    if ("01" == $id) {
      wx.navigateTo({
        url: 'details/index'
      })
    }
    if ("02" == $id) {
      wx.navigateTo({
        url: 'details/index'
      })
    }
  },

})